﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using SimhoppKjellsFavoriterVT13;


namespace Kjellsfavoriter_TEST
{
    [TestFixture]
    class Contestant_test
    {
        Contestant contestant;

        Jump testJump1;
        Jump testJump2;
        Jump testJump3;
        Jump testJump4;
        Jump testJump5;
        Jump testJump6;

        Judge testJudge1;
        Judge testJudge2;
        Judge testJudge3;
        Judge testJudge4;
        Judge testJudge5;
        Judge testJudge6;

        private void initializeJudges(Jump jump, float total)
        {
            for (int i = 0; i < 7; i++)
            {
                Judge j = new Judge();
                j.Total = total;
                jump.Judges.Add(j);
            }
        }

        [SetUp]
        protected void SetUp()
        {
            testJump1 = new Jump();
            testJump2 = new Jump();
            testJump3 = new Jump();
            testJump4 = new Jump();
            testJump5 = new Jump();
            testJump6 = new Jump();

            testJudge1 = new Judge();
            testJudge2 = new Judge();
            testJudge3 = new Judge();
            testJudge4 = new Judge();
            testJudge5 = new Judge();
            testJudge5 = new Judge();

            contestant = new Contestant();

            initializeJudges(testJump1, 1);
            initializeJudges(testJump2, 3);
            initializeJudges(testJump3, -2);
            initializeJudges(testJump4, 11);
            initializeJudges(testJump5, 0);
            initializeJudges(testJump6, 5);

            contestant.addJump(testJump1);
            contestant.addJump(testJump2);
            contestant.addJump(testJump3);
            contestant.addJump(testJump4);
            contestant.addJump(testJump5);
            contestant.addJump(testJump6);
        }
        

        [Test]
        public void testGetScoreForJumpAndJudge()
        {

            float jumptest1 = contestant.getScoreForJumpAndJudge(1, 1);
            float jumptest2 = contestant.getScoreForJumpAndJudge(2, 1);
            float jumptest3 = contestant.getScoreForJumpAndJudge(3, 1);
            float jumptest4 = contestant.getScoreForJumpAndJudge(4, 1);
            float jumptest5 = contestant.getScoreForJumpAndJudge(5, 1);
            float jumptest6 = contestant.getScoreForJumpAndJudge(6, 1);

            Assert.AreEqual(1, jumptest1);
            Assert.AreEqual(3, jumptest2);
            Assert.AreEqual(-1, jumptest3);
            Assert.AreEqual(-1, jumptest4);
            Assert.AreEqual(0, jumptest5);
            Assert.AreEqual(5, jumptest6);
        }


        [Test]
        public void testGetJudgeFromJump()
        {
            testJudge1 = contestant.getJudgeFromJump(1, 1);
            testJudge2 = contestant.getJudgeFromJump(1, 2);
            testJudge3 = contestant.getJudgeFromJump(1, 3);
            testJudge4 = contestant.getJudgeFromJump(1, 4);
            testJudge5 = contestant.getJudgeFromJump(1, 5);
            testJudge6 = contestant.getJudgeFromJump(1, 6);
        }
    }
}
